# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-spark-parser
pkgname=('python2-spark-parser' 'python-spark-parser')
_pkgname=spark_parser
pkgver=1.9.0
pkgrel=1
pkgdesc='An Earley-Algorithm Context-free grammar Parser Toolkit.'
arch=('any')
url='https://pypi.org/project/spark-parser/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/spark_parser-$pkgver.tar.gz")
sha512sums=('ee1c374dc91b2237a5dd16c682d72ec1883559aceaccbbcfce4f19aa5a5af533f7d70a0c188a300745d2ec3085a23577eaf50cab9d580e32c47af23977518dee')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-spark-parser() {
  depends=('python2' 'python2-click')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/spark-parser-coverage" \
    "$pkgdir/usr/bin/spark-parser-coverage2"
}

package_python-spark-parser() {
  depends=('python' 'python-click')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

